Skip to content

Conversation

@ManojTestsigma
Copy link
Contributor

@ManojTestsigma ManojTestsigma commented Jan 21, 2026

please review this addon and publish as PUBLIC

Addon name : Google Authenticator code generator
Addon accont: https://jarvis.testsigma.com/ui/tenants/2817/addons
Jira: https://testsigma.atlassian.net/browse/CUS-10144

fix

Added existing NLP to salesforce application type.

Summary by CodeRabbit

  • New Features
    • Added Google Authenticator code generation functionality for Salesforce testing. Users can now generate time-based one-time passwords (TOTP) from a secret key and store the generated codes in runtime variables for use in test automation.

✏️ Tip: You can customize this high-level summary in your review settings.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

A new Maven module adds the Google Authenticator code generator addon for Testsigma, consisting of a POM configuration file and a Java class that generates time-based one-time passwords (TOTP) from a provided secret key and stores the result in a runtime variable.

Changes

Cohort / File(s) Summary
Module Configuration
Google Authenticator code generator/pom.xml
Defines Maven project coordinates (com.testsigma.addons:google_authenticator_code_generator:1.0.4), build properties (Java 11, UTF-8 encoding), and dependencies including Testsigma SDK, Aerogear OTP, Selenium, Appium, Jackson, and testing frameworks. Configures maven-shade-plugin and maven-source-plugin.
TOTP Generation Action
Google Authenticator code generator/src/main/java/com/testsigma/addons/salesforce/GoogleAuthCodeGenerator.java
Implements a new Salesforce action class that extends SalesforceAction, generates TOTP using the Aerogear OTP library, and stores the generated code in a runtime variable. Includes test data annotation for secret key input, runtime data handling, error logging, and success/error message reporting.

Sequence Diagram

sequenceDiagram
    participant Client as Test Runner
    participant Action as GoogleAuthCodeGenerator
    participant OTP as Aerogear OTP Library
    participant Runtime as Runtime Variable Storage

    Client->>Action: execute(secret: "...")
    activate Action
    Action->>OTP: new Totp(secret)
    activate OTP
    OTP-->>Action: Totp instance
    deactivate OTP
    Action->>OTP: now()
    activate OTP
    OTP-->>Action: generated TOTP code
    deactivate OTP
    Action->>Runtime: setTestData(totp_code)
    activate Runtime
    Runtime-->>Action: acknowledged
    deactivate Runtime
    Action-->>Client: Result.success("TOTP generated")
    deactivate Action
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • Ganesh-Testsigma
  • vigneshtestsigma

Poem

🐰 A secret key hops into our care,
Time-based tokens float through the air,
Aerogear magic spins the OTP round,
Salesforce actions now abound,
TOTP tests dance without a care! 🔐

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title mentions adding NLP to Salesforce, but the actual changes introduce a new Google Authenticator code generator addon module with Maven configuration and implementation code, which is not explicitly reflected in the title. Clarify whether 'existing NLP' refers to this Google Authenticator generator or if the title should specifically mention the new addon being added.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@Google` Authenticator code
generator/src/main/java/com/testsigma/addons/salesforce/GoogleAuthCodeGenerator.java:
- Line 37: The debug log call logs a sensitive Totp object
(otpGenerator.toString()), potentially exposing secret keys; remove or replace
the logger.debug(otpGenerator.toString()) call in GoogleAuthCodeGenerator and
instead log a non-sensitive indication (e.g., success/flow state) or
masked/hashed identifier if you need correlation, ensuring you never call
toString() on the Totp/otpGenerator object or print any secret material.
- Around line 33-51: The method in GoogleAuthCodeGenerator initializes
com.testsigma.sdk.Result result = com.testsigma.sdk.Result.SUCCESS but never
changes it on error; update the catch block to set result =
com.testsigma.sdk.Result.FAILED (or Result.FAILED) before returning so failures
are reported correctly, and keep returning the result variable at the end of the
method.
🧹 Nitpick comments (4)
Google Authenticator code generator/src/main/java/com/testsigma/addons/salesforce/GoogleAuthCodeGenerator.java (2)

11-11: Unused import.

NoSuchElementException is imported but never used. The execute() method declares it in the throws clause, but no code actually throws this exception.

Suggested fix
-import org.openqa.selenium.NoSuchElementException;

And update the method signature:

-    public com.testsigma.sdk.Result execute() throws NoSuchElementException {
+    public com.testsigma.sdk.Result execute() {

45-48: Improve error logging consistency.

The catch block uses logger.debug for the error message but logger.info for the stack trace. For error scenarios, consider using consistent log levels. Also, concatenating error.getMessage() + error.getCause() can produce confusing output (e.g., "some message" + null).

Suggested improvement
         } catch (Exception error) {
-            logger.debug(error.getMessage() + error.getCause());
-            logger.info("stack trace : " + ExceptionUtils.getStackTrace(error));
+            logger.error("TOTP generation failed: {}", error.getMessage());
+            logger.debug("Stack trace: {}", ExceptionUtils.getStackTrace(error));
             setErrorMessage("Operation Failed.Please check the logs for more info");
Google Authenticator code generator/pom.xml (2)

42-46: TestNG version is outdated.

TestNG 6.14.3 is from 2018. Consider upgrading to a more recent version (7.x) for better compatibility and bug fixes.

Suggested update
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>6.14.3</version>
+            <version>7.8.0</version>
+            <scope>test</scope>
         </dependency>

36-46: Both JUnit 5 and TestNG are included as test dependencies.

The POM includes both JUnit Jupiter and TestNG. If only one testing framework is actually used, consider removing the unused one to reduce dependency footprint. Also note that TestNG is missing the <scope>test</scope> declaration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants